<%@ page contentType="text/html;charset=UTF-8" language="java"
	isELIgnored="false"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
	<head>
		<title>上传文件列表</title>
		<meta name="search" content="price" />
		<meta name="author" content="chunhai.chen(15317227@qq.com)" />
	</head>

	<body>
		<div class="main">
			<table width='100%' id="customerTable" class="yui-grid">
				<thead>
					<tr>
						<th width=1 nowrap><A href='/admin/attachments.asp'>全部文件</A></th>
						<th>
						<p style='font-size: 20px;margin:0'>管理中心：文件资料列表</p>
						</th>
						<th><A href='/admin/attachment/add.asp'>上传文件</A></th>
					</tr>
				</thead>
				<c:if test="${not empty attachments}">
					<tr>
						<th width=1 nowrap> 文件类型 </th> <th> 名称 </th> <th width=1 nowrap> 操作 </th>
					</tr>
					<c:forEach items="${attachments}" var="v" varStatus="vst">
						<tr>
							<td width=1 nowrap>
								<A href='/admin/attachments.asp?fileType=${v.fileType}'><c:out value="${v.fileType}" default=""/></A>
							</td>
							<td>
								<A href='/admin/attachment/${v.uid }.asp'><c:out value="${v.name}" default="No-File-Name"/></A>
							</td>
							<td width=1 nowrap>
								<A href='/admin/attachment/edit.asp?uid=${v.uid }'>编辑</A>

								<A href='/admin/attachment/delete.asp?uid=${v.uid }'>删除</A>
							</td>
						</tr>
					</c:forEach>
				</c:if>

				<tr>
					<td colspan='3'>建议采用第三方网站保存图片，例如<A href='http://www.poco.cn/' target=_blank>http://www.poco.cn/</A></td>
				</tr>				
			</table>
			
			<c:if test="${totalItems > pageSize}">
				<div id="Pagination" class="pagination"></div>
			
				<c:set var="requester" value="<%=request.getServerName()+ (request.getServerPort()==80 ? "" : ":"+request.getServerPort())%>"/>
				<script type="text/javascript" src="/js/jquery.pagination.js"></script>
		 		<script type="text/javascript">
		            /**
		             * Callback function that displays the content.
		             *
		             * Gets called every time the user clicks on a pagination link.
		             *
		             * @param {int}page_index New Page index
		             * @param {jQuery} jq the container with the pagination links as a jQuery object
		             */
					function pageselectCallback(page_index, jq){
		                // Replace old content with new content
						// $('#Searchresult').html(newcontent);
						// return false;
		                
		                return true;
		            }
		            
		
		            // When document has loaded, initialize pagination and form 
		            $(document).ready(function(){
						var url="/admin/attachments.htm?pageNo=__id__&pageSize=${pageSize}";
		
						var totalItems = "${totalItems}";
		                var optInit = {
										callback: pageselectCallback,
										current_page: "${pageNo}",
										link_to: url,
										items_per_page: "${pageSize}",
										num_display_entries: 8,
										num_edge_entries: 2,
										prev_text: "上一页",
										next_text: "下一页"
									};
		                $("#Pagination").pagination(totalItems, optInit);              
		            });
		            
		        </script>
			</c:if>				
			
		</div>
	</body>

</html>

